﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

public partial class user_user_chg_pwd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
        }
        else
        {
            TUser.CheckUser(this);

            btnSave2.Attributes.Add("OnClick", "javascript:return chk();");
        }
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        this.Response.Redirect("user_myself.aspx");
    }
    protected void btnSave2_Click(object sender, EventArgs e)
    {
        string sid = this.Session["ecrm_uid"].ToString();
        string semail = this.Session["ecrm_email"].ToString();

        if (TUser.CheckLogin(semail, oldpassword.Text))
        {
            TUser oUser = new TUser(sid);
            oUser.ChangePWD(newpassword.Text);
           
            this.Response.Redirect("user_myself.aspx");
        }
        else
        {
            msg.Text = "密码不正确！";
        }
    }
}
